<?
    include './common.php';
    $username = $_POST["user"];
    $msg = $_POST["message"];
    // echo $username.$msg;
    $sql = "INSERT INTO users (username,msg) VALUES ('{$username}','{$msg}')";
    $res = mysqli_query($link,$sql);//当sql为查询语句的时候，res取到的是一个数据集
    $data = [];
    if($res){
        $data['status'] = 1 ; 
        $data['data'] = "添加成功";            
    }  else {
        $data['status'] = 0 ; 
        $data['data'] = "添加失败";    
    }
    echo json_encode($data);
?>